package mmoon.mmoonstory.interfaces;

import mmoon.mmoonstory.MMoonUtils;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.registry.GameRegistry;

import java.util.Random;

public interface InitWorldGenerator extends IWorldGenerator {
    default void Init() {
        MMoonUtils.MMOON_WORLD_GENERATORS.add(this);
    }

    int getWeight();

    default void reg() {
        GameRegistry.registerWorldGenerator(this, this.getWeight());
    }

    static BlockPos randomPosInChunk(Random random, int x, int z, int minY, int maxY) {
        return new BlockPos(x * 16 + random.nextInt(16), minY + random.nextInt(maxY - minY), z * 16 + random.nextInt(16));
    }
}
